import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author ghp
 * @date 2023/5/31
 * @title
 * @description
 */
public class ArrToMapTest {
    public static void main(String[] args) {
        int[] arr = new int[]{-1,0,1,2,-1,-4};
        Map<Integer, Integer> map = Arrays.stream(arr)
                .boxed()
                .collect(Collectors.toMap(i -> i, i -> 1, Integer::sum));
        System.out.println(map);
    }
}
